﻿using System;
using System.Web.UI;
using Wei8808Cms.BLL;
using Wei8808Cms.Model;
using Wei8808Cms.WebSite.UI;

namespace Wei8808Cms.WebSite.admin.NewType
{
    public partial class AddNewTypeInfoForm : BasicPage
    {
        private readonly NewTypeBLL _bll = new NewTypeBLL();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;
            chkLoginLevel("AddNewType");
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var model = new NewTypeInfo
                                {
                                    NewTypeName = txtNewTypeName.Text.Trim(),
                                    CreateUser = "李波",
                                    CreateTime = DateTime.Now
                                };
                _bll.Add(model);
                JscriptPrint("增加成功！", "AddNewTypeInfoForm.aspx", "Success");
            }
            catch (Exception ex)
            {
                JscriptPrint("异常：" + ex.Message, "AddNewTypeInfoForm.aspx", "Error");
            }
        }
    }
}